/**
 * @author LKQ
 * @date 2021/12/11 17:14
 * @description
 */
public class Solution {
    public static void main(String[] args) {

    }

    public int largestAltitude(int[] gain) {
        int n = gain.length;
        for (int i = 0; i < n; i++) {
            if (i == 0) {
                continue;
            }
            int temp = gain[i-1];
            gain[i] += temp;
        }
        int start = 0;
        for(int i: gain) {
            if (start <= i) {
                start = i;
            }
        }
        return start;
    }
}
